using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace MoLingsArmory.Content.Projectiles
{
    public class DeathRayProj : ModProjectile
    {
        public override void SetDefaults()
        {
            Projectile.width = 8;
            Projectile.height = 8;
            Projectile.aiStyle = -1;
            Projectile.friendly = true;
            Projectile.DamageType = DamageClass.Magic;
            Projectile.extraUpdates = 100;
            Projectile.timeLeft = 200;
            Projectile.penetrate = 1;
        }
        public override void AI()
        {
            Projectile.localAI[0] += 1f;
            if (Projectile.localAI[0] > 3f)
            {
                for (int num375 = 0; num375 < 4; num375++)
                {
                    Vector2 vector34 = Projectile.position;
                    vector34 -= Projectile.velocity * (num375 * 0.25f);
                    Projectile.alpha = 255;
                    int num376 = Dust.NewDust(vector34, 1, 1, DustID.Electric);
                    Main.dust[num376].position = vector34;
                    Main.dust[num376].position.X += Projectile.width / 2;
                    Main.dust[num376].position.Y += Projectile.height / 2;
                    Main.dust[num376].scale = 0.5f;
                    Main.dust[num376].noGravity = true;
                    Dust dust2 = Main.dust[num376];
                    dust2.velocity *= 0.2f;
                }
            }
        }
    }
}